<template>
  <el-container>
    <el-aside width="200px">
      <h1>王者资料库</h1>
      <el-menu default-active="2" class="el-menu-vertical-demo" background-color="#001529" @select="selectItem"
        text-color="#fff" active-text-color="#CCFFFF">
        <el-menu-item index="/dashboard/heros">
          <i class="el-icon-user-solid"></i>
          <span slot="title">英雄资料</span>
        </el-menu-item>
        <el-menu-item index="/dashboard/equips">
          <i class="el-icon-s-goods"></i>
          <span slot="title">道具资料</span>
        </el-menu-item>
        <el-menu-item index="/dashboard/skills">
          <i class="el-icon-coordinate"></i>
          <span slot="title">技能资料</span>
        </el-menu-item>
        <el-menu-item index="/dashboard/mings">
          <i class="el-icon-coordinate"></i>
          <span slot="title">铭文资料</span>
        </el-menu-item>

        <el-submenu index="4">
          <template slot="title">
            <i class="el-icon-setting"></i>
            <span slot="title">系统配置</span>
          </template>
          <el-menu-item index="/dashboard/users">
            <i class="el-icon-s-custom"></i>
            <span slot="title">用户管理</span>
          </el-menu-item>
          <el-menu-item index="/hint">
            <i class="el-icon-lock"></i>
            <span slot="title">权限管理</span>
          </el-menu-item>
        </el-submenu>
      </el-menu>
    </el-aside>

    <el-container>
      <el-header>
        <el-dropdown :style="{ borderBottom: personseen == true ? '3px solid orange' : '' }">
          <span @click="clickPersonPage" class="el-dropdown-link">
            <el-avatar :size="45">
              <img src="../assets/default-header.png" />
            </el-avatar>
            <i class="el-icon-arrow-down el-icon--right" style="font-size:20px"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item @click.native="clickPersonal">个人中心</el-dropdown-item>
            <el-dropdown-item @click.native="setHandle">设置</el-dropdown-item>
            <el-dropdown-item @click.native="exitHandle">退出登录</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
        <span class="homePage" @click="clickHomePage" :style="{ borderBottom: homeseen == true ? '3px solid orange' : '' }"><i
            class="el-icon-s-home"></i></span>
        <span style="cursor:pointer" @click="clickHeroPage"><i class="el-icon-star-on"></i></span>
      </el-header>
      <el-main>
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  data() {
    return {
      personseen: false,
      homeseen: true
    }
  },
  methods: {
    selectItem(index) {
      this.$router.push(index);
    },
    //点击个人头像事件
    clickPersonPage() {
      this.personseen = true;
      this.homeseen = false;
    },
    //点击 主页事件
    clickHomePage() {
      this.homeseen = true;
      this.personseen = false;
      this.$router.push("/dashboard/homePage");
    },
    clickHeroPage() {
      this.$router.push("/mainlist/heroslist");
    },
    //点击个人中心事件
    clickPersonal() {
      this.$router.push("/dashboard/users");
    },
    //点击 设置 事件
    setHandle() {
      this.$router.push("/hint");
    },
    //退出登录事件
    exitHandle() {
      this.$router.push("/userLogin");
    },
  },
};
</script>

<style>
.el-header {
  background-color: #001529;
  color: #333;
  line-height: 80px;
  display: flex;
  flex-direction: row-reverse;
}

.el-header i {
  color: azure;
  font-size:40px
}

.el-aside {
  background-color: #001529;
  color: #333;
  text-align: center;
  height: 100%;
}

.el-aside h1 {
  font-size: 20px;
  background-color: #001529;
  color: white;
  height: 60px;
  line-height: 60px;
}

.el-main {
  width: 100%;
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  overflow-x: hidden;
}

body>.el-container {
  margin-bottom: 40px;
  height: 100%;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}

.box-card {
  width: 100%;
  margin: 0 auto;
}

.box-card :hover {
  cursor: pointer;
}

.homePage {
  width: 55px;
  height: 58px;
  margin: 0px 8px;
  text-align: center;
  cursor: pointer;
}

.el-dropdown {
  vertical-align: middle;
  text-align: center;
}

.el-dropdown-link {
  cursor: pointer;
  color: whitesmoke;
}

.el-icon-arrow-down {
  font-size: 12px;
}
</style>